import http from "@/utils/request";

// 获取打印机
export async function getStoreSettings(): Promise<API.Result> {
    return http.get("store_settings/printer_list");
}

// 纸数量设置
export async function updateTonerRemaining(printerId: number, toner: number): Promise<API.Result> {
    return http.put("store_settings/update_toner_remaining/" + printerId, {toner});
}

// 纸价格设置
export async function updatePaperPrice(id: number, data: any): Promise<API.Result> {
    return http.post("store_settings/update_paper_price/" + id, data);
}

// 纸数量设置
export async function updatePaperRemaining(printer_id: number, paper_a4_count: number, paper_a3_count: number): Promise<API.Result> {
    return http.post("store_settings/update_paper_remaining", {printer_id, paper_a4_count, paper_a3_count});
}

// 生成打印机二维码
export async function createQRCode(printerId: number): Promise<API.Result> {
    return http.get(`store_settings/printer_create_qr_code?printer_id=${printerId}`);
}

// 修改打印机信息
export async function updatePrinterInfo(data: object): Promise<API.Result> {
    return http.put(`store_settings/update_printer_info`, data);
}